package logic

import (
	"context"
	"shop/goods"
	"shop/internal/svc"
	"shop/model/redis"

	"github.com/zeromicro/go-zero/core/logx"
)

type CartDeleteLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewCartDeleteLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CartDeleteLogic {
	return &CartDeleteLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

func (l *CartDeleteLogic) CartDelete(in *goods.CartDeleteRequest) (*goods.CartDeleteResponse, error) {
	// todo: add your logic here and delete this line
	redis.CartDelete(in.UserId, in.GoodsId)
	return &goods.CartDeleteResponse{
		Success: true,
	}, nil
}
